package com.ideyatech.allowancereceipts.entity;

import java.util.Collection;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hightides.annotations.Controller;
import org.hightides.annotations.Dao;
import org.hightides.annotations.Page;
import org.hightides.annotations.Service;
import org.hightides.annotations.TextField;
import org.opentides.bean.BaseCriteria;
import org.opentides.bean.BaseSortableEntity;

@Dao
@Controller
@Service
@Page
@Entity
@Table(name = "ESTABLISHMENT")
public class Establishment extends BaseSortableEntity implements BaseCriteria {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5030042077438592890L;

	@Basic(optional = false)
	@Column(name = "NAME", length = 512)
	@TextField(requiredField = true, label = "Name", listed = true)
	private String name;

	@Basic(optional = false)
	@Column(name = "TIN", length = 32)
	@TextField(requiredField = true, label = "TIN", listed = true)
	private String taxIDNumber;

	@Basic(optional = false)
	@Column(name = "ADDRESS", length = 512)
	@TextField(requiredField = true, label = "Address", listed = true)
	private String address;

	@Basic(optional = false)
	@Column(name = "MUNICIPALITY", length = 512)
	@TextField(requiredField = true, label = "Municipality", listed = true)
	private String municipality;
	
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "establishment")
	private Collection<Receipt> receipts;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getTaxIDNumber() {
		return taxIDNumber;
	}

	public void setTaxIDNumber(String taxIDNumber) {
		this.taxIDNumber = taxIDNumber;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getMunicipality() {
		return municipality;
	}

	public void setMunicipality(String municipality) {
		this.municipality = municipality;
	}

}
